<?php

$flag = true;

$loginpath = templet('register', 'index');
if (file_exists($loginpath)) {
    include $loginpath;
    $flag = false;
    include(templet('index','footer'));
}


if ($flag) {

?>
<link rel="stylesheet" href="/shop/templates/default/home/register/Css/common.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="/shop/templates/default/home/register/Css/jumei_sign.css" type="text/css" media="screen" charset="utf-8" />
<script src="/shop/templates/default/home/register/Scripts/es5-shim.js"></script>
<script src="/shop/templates/default/home/register/Scripts/es5-sham.js"></script>

<?php
$config = Model('setting')->getListSetting();

@include dirname(BASE_PATH) . '/shop/templates/' . $config['template_name'] . '/fix_member.php';

?>

<style>
    #footer{
        display: none !important;
    }
    #footer.wrapper{
        display: block !important;
    }
</style>



<script src="/shop/templates/default/home/register/Scripts/website.min.js"></script>
<script src="/shop/templates/default/home/register/Scripts/boot.js"></script>
<script src="/shop/templates/default/home/register/Scripts/jquery.cookie.js"></script>

<script>
    
</script>

<style>
    .top_nav_hot{ position: absolute;left:81px;top:-4px;}
    .loginWrap{
        margin-bottom: 150px !important;
    }
</style>
<div id="header_container">
    <!--新版的login页面没有头部 -->
    <div id="logo">
        <a href="/" id="home" title="" style="background:url(   ) no-repeat top left;">
            <img height="85" src="<?php echo UPLOAD_SITE_URL.DS.ATTACH_COMMON.DS.$output['setting_config']['site_logo']; ?>" alt="">
        </a>
        <div class="header_logo_box">
            <?php echo loadadv(40);?>
            <?php echo loadadv(41);?>
            <?php echo loadadv(42);?>
        </div>
    </div>
</div>

<script>
$(document).ready(function () {
$(".top_hot").hover(function () {
$(".top_nav_hot").css("display","none")
},
function () {
$(".top_nav_hot").css("display","block")
}
);
});
</script>

<link href="/shop/templates/default/home/register/Css/signup.css" rel="stylesheet"/>
<script>
 var REDIRECT = '';
 var IS_OPEN_PASSPORT = true;
</script>
<script>
    // seajs.use('signup/index', function() {});
</script>
<div class="sign registerpage">
    <div class="loginWrap">
        <style>
            .loginPic{
                background: none !important;
            }
        </style>
        <div class="loginPic " style='position: relative;'>
            <?php echo loadadv(39);?>
                        <!-- <span class="signup_link"></span> -->
            <div class="loginBord">
                <div class="loginTit">
                    <div class="tosignup">已有账号<a href="?act=login&op=login">在此登录</a></div>
                    <h1><strong>用户注册</strong></h1>
                </div>
                <form id="phone" method="post"  action="/shop/index.php?act=login&op=usersave">
                    <input type='hidden' name='formhash' value='_WVnRES5Ba2a7ULA4AGVooS0G1Cyqm7' /> 
                    <div class="line">
                        <div class="textbox_ui">
                            <input type="text" id="user_name" name='user_name' placeholder="用户名" autofocus autocomplete="off" value="">
                            <div class="focus_text">请输入6-16位的字母/数字</div>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                            <i class="valid"></i>
                            <i class="loading"></i>
                        </div>
                    </div>
                                      <div class="line verityWrap">
                        <div class="textbox_ui">
                            <input type="text" placeholder="验证码" name='captcha' id="verify_code" autocomplete="off">
                            <div class="focus_text">按右图填写，不区分大小写</div>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                        </div>
                        <span id="change_verify_code" onclick="document.getElementById('codeimage2').src='index.php?act=seccode&op=makecode&nchash=6bda07d8&t=' + Math.random();">
                            <img height='40' width='65' id='codeimage2' src="index.php?act=seccode&op=makecode&nchash=435afca7" >
                            换一张
                        </span>
                    </div>
                    <div class="line ">
                        <div class="textbox_ui">
                            <input type="text" placeholder="手机号码" name='mobile_phone' id="mobile_phone" autocomplete="off">
                            <div class="focus_text">请输入正确的手机号码</div>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                        </div>
                        <!-- <span id="change_verify_code" onclick="document.getElementById('codeimage').src='index.php?act=seccode&op=makecode&nchash=6bda07d8&t=' + Math.random();">
                            <img height='40' width='65' id='codeimage' src="index.php?act=seccode&op=makecode&nchash=435afca7" >
                            换一张
                        </span> -->
                    </div>
                                      <div class="line verityWrap">
                        <div class="textbox_ui sms_verify_wrapper">
                            <input type="text" id="mobile_verify" name='mobile_verify' placeholder="短信校验码" autocomplete="off">
                                                            <div class="focus_text">请输入6位短信校验码</div>
                                                        <div class="hint"></div>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                        </div>
                                            <a href="javascript:;" id="getPhoneCode" class="phonecode" data-verifyType="sms"><strong>获取短信校验码</strong></a>
                                        </div>
                    <div class="line">
                        <div class="textbox_ui">
                            <input type="password" placeholder="密码" name='password' id="password" autocomplete="off">
                            <div class="focus_text">
                                <p class="default">6-16个字符，建议使用字母加数字或符号组合</p>
                                <div class="safe">
                                    <div class="pw_isstrong clearfix">
                                        <div class="pw_level pw_success" data-class="pw_weak" data-strength="weak">弱</div>
                                        <div class="pw_level pw_success" data-class="pw_normal" data-strength="normal">中</div>
                                        <div class="pw_level pw_success" data-class="pw_strong" data-strength="strong" style="border-right:0">强</div>
                                    </div>
                                </div>
                            </div>
                            <i class="valid"></i>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                        </div>
                    </div>
                    <div class="line">
                        <div class="textbox_ui">
                            <input type="password" id="password2" name='password_confirm' placeholder="重复密码" autocomplete="off">
                            <div class="focus_text">请再次输入密码</div>
                            <i class="valid"></i>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                        </div>
                    </div>
                    <div class="line">
                        <div class="textbox_ui">
                            <input type="text" id="invite_code" name='invite_code' placeholder="邀请码，没有则不填" autocomplete="off">
                            <div class="focus_text">输入邀请码，没有可以不填</div>
                            <i class="valid"></i>
                            <div class="invalid">
                                <i></i>
                                <div class="msg"></div>
                            </div>
                        </div>
                    </div>
                                        <div class="act" style="margin-left: 0px;">
                        <p>
                            <input type="submit" class="submit_btn" value="同意协议并注册" name="mobileCommit" style="width: 100%;">
                        </p>
                        <p>
                            <?php
                                $aid = Model()->table('article')->where(array('article_title' => '悦海购用户协议'))->find();
                                if(count($aid)){
                                    $aid = $aid['article_id'];
                                }
                            ?>
                            <a href="/shop/index.php?act=document&code=agreement" rel="nofollow" target="_blank" style="color:#ed145b;">《用户协议》</a>
                        </p>
                    </div>
                    <br />
                </form>
                <div class="shadow_l"></div>
                <div class="shadow_r"></div>
            </div>
        </div>
    </div>
</div>
<div class="clear"></div>
<script type="text/javascript">
 /*301 www域名跳转
  *jiel
  */
 $(function () {
     var cur_location = $.cookie('default_site_25') || '';
     if (cur_location == '') {
         $.getJSON(RM_SITE_MAIN_WEBBASEURL + 'i/ajax/getsite?callback=?', function (data) {
             cur_location = data.site;
         })
     }
     var url_host = window.location.host.slice(0,2); //获取当前地址域名

     if(url_host =='bj' || url_host =='sh'|| url_host =='gz' || url_host =='cd'){
         if(url_host != cur_location) {
             $.cookie('default_site_25',url_host,{expires: 1,path: "/",domain: RM_SITE_MAIN_TOPLEVELDOMAINNAME});
             cur_location = url_host;
         }
     }
     $("body").delegate("a,area", "click", function () {
         if(cur_location == ''){ cur_location ='www'};
         var href = $(this).attr("href") || '';
         if(href.indexOf('/i/deal/mobile_subscribe')<0 && href !=''){
             var reg = new RegExp("^(http://)(hd(?=.jumei.com)|huodong(?=.jumei.com)|www(?=.jumei.com/i/deal))(.*)$","i");
             var href =href.replace(reg, "$1"+ cur_location +"$3");
             $(this).attr("href",href);
         }
     })
 })
</script>


<!--*连续登陆探测 -->

<!--点击流用-->
<script type="text/javascript" charset="utf-8" src="/shop/templates/default/home/register/Scripts/clk_jumei.js"></script>
<script type="text/javascript" charset="utf-8" src="/shop/templates/default/home/register/Scripts/jumei.clickmap.js"></script>




<style>
    #footer{
        display: block !important;
    }

    #footer {
        display: none !important;
    }
    #footer.wrapper{
        display: block !important;
    }
    #footer .footer_link{
        display: block;
    }
</style>

<script>
    var validate = function(form,rule){

        form.submit(function(){
            $(this).find('input').blur();
            if($('.error_ui').length){
                return false;
            }
        });


        form.delegate('input', 'focus', function(event) {
            var box = $(this).parents('.textbox_ui');
            if(!this.getAttribute('msg')){
                var msg = box.find('.msg').text();
                this.setAttribute('msg',msg);
            }
            box.find('.msg').empty();
            box.removeClass('error_ui');
            box.find('.invalid').hide();

            
        });
        form.delegate('input','blur',function(){
            for(var i in rule){
                if(this.id == i){
                    if(rule[i].format){
                        if(!rule[i].format[0].test(this.value)){
                            $(this).parents('.textbox_ui').addClass('error_ui').find('.msg').text(rule[i].format[1]);
                            $(this).parents('.textbox_ui').find('.invalid').show();
                            return false;
                        }
                    }
                    if(rule[i].ajax){
                        var _this = this;
                        $.post(rule[i].ajax[0],{val : $.trim(this.value)},(function(item,_this){
                            return function(msg){
                                if(msg == 'failed'){
                                    $(_this).parents('.textbox_ui').addClass('error_ui').find('.msg').text(item[1]);
                                    $(_this).parents('.textbox_ui').find('.invalid').show();
                                }
                            }
                        })(rule[i].ajax,this));
                    }
                }

            }
            if(this.id == 'password'){
                if(this.value != $('#password2').val() && $('#password2').val() != ''){
                    $(this).parents('.textbox_ui').addClass('error_ui').find('.msg').text("确认密码需和密码一样！");
                    $(this).parents('.textbox_ui').find('.invalid').show();
                    return false;
                }
            }
            if(this.id == 'password2'){
                if(this.value != $('#password').val() && $('#password').val() != ''){
                    $(this).parents('.textbox_ui').addClass('error_ui').find('.msg').text("确认密码需和密码一样！");
                    $(this).parents('.textbox_ui').find('.invalid').show();
                    return false;
                }
            }
            var msg;
            if(msg = this.getAttribute('msg')){
                $(this).parents('.textbox_ui').find('.msg').text(msg);
            }
        });
    }

    var rule = {
        user_name : {
            format : [/^[\w]{6,16}$/i,"格式错误，请输入6-16位的字母/数字"],
            ajax : ['index.php?act=seccode&op=checkuser','该用户名已被人注册']
        },
        password : {
            format : [/^.{6,16}$/i,'格式错误,请输入6-16位的字符']
        },
        password2 : {
            format : [/^.{6,16}$/i,'格式错误,请输入6-16位的字符']
        },
        mobile_phone : {
            format : [/^1[345789][0-9]{9}$/,'手机号码的格式错误']
        },

        // mobile_verify  : {
        //     format : [/^[0-9]{6}$/,'请输入6位短信校验码']
        // }
    }

    validate($('#phone'),rule);


        var coldDown = function(elem){
            elem.unbind('click',send_message);

            var count = 60;
            var timer = setInterval(function(){
                elem.find('strong').text('重发短信（' + count + '）');

                if(--count == 0){
                    elem.bind('click',send_message);
                    elem.find('strong').text('获取短信校验码');
                    clearInterval(timer);
                }

            },1000);
        }


        var send_message = function(){
            var mobile = $.trim($('#mobile_phone').val());
            if(!/^1[345789][0-9]{9}$/.test(mobile)){
                layer.msg('请输入正确的机号码！');
            }


            var captcha_error = 0x01;
            var mobile_error = 0x01 << 1;
            var mobile_same = 0x01 << 2;
            var error = 0x01 << 3;

            var nchash = $('#codeimage2').attr('src').match(/nchash=([^&]+)/)[1]

            var index = layer.load();
            $.get('/shop/index.php?act=seccode&op=send_message',{nchash : nchash,mobile : mobile, captcha : $.trim($('#verify_code').val())},function(msg){

                console.log(msg);

                layer.close(index);

                if(msg & captcha_error){
                    layer.msg('验证码错误！');
                    return;
                }

                if(msg & mobile_error){
                    layer.msg('手机号码错误！');
                    return;
                }

                if(msg & mobile_same){
                    layer.msg('该手机号码已被注册');
                    return;
                }

                if(msg & error){
                    layer.msg('发送失败，请稍后重试！');
                    return;
                }

                //成功的处理
                layer.msg('短信发送成功');
                coldDown($('#getPhoneCode'));

            });

        }


        $('#getPhoneCode').bind('click',send_message);



</script>
<?php }?>
